package org.ddevil.data.set;

import org.ddevil.data.Data;
import org.ddevil.data.Filter;


/**
 * A DataSet that supports non-destructive filtering on attribute values.
 * Setting a Filter for an attribute means that for each record in this DataSet
 * the applied filter.accept(Object) method will be called on the value for that
 * attribute and the record will be filtered based on the result.
 * Since the filtering is a non-destructive process you can clear them at any time
 * and all filtered records will return.
 *
 * @author Rich
 * @author Eric
 */
public interface FilterableDataSet<T extends Data> extends DataSet<T> {

    /**
     * Apply the filter to the given attribute.
     *
     * @param dbId
     *          The attribute to filter.
     * @param filter
     *          The filter to apply.
     */
    public abstract void setFilter(String dbId, Filter<Object> filter);

    /**
     * Get the current filter for the given attribute.
     *
     * @param dbid
     *          The attribute to get the filter of.
     * @return
     *          The filter currently being applied to that attribute.
     */
    public abstract Filter<Object> getFilter(String dbid);

    /**
     * Remove all filters on this DataSet.
     */
    public abstract void clearAllFilters();

}
